let volunteerCounts = [1,3,40,32,2,53,77,13]
func sortAscending(_ i: Int, _ j: Int) -> Bool {
    return i < j
}
var volunteersSorted = volunteerCounts.sorted(by: sortAscending)
print(volunteersSorted)

volunteersSorted = volunteerCounts.sorted(by: {
    (i: Int, j: Int) -> Bool in
    return i < j
})
print(volunteersSorted)

volunteersSorted = volunteerCounts.sorted(by: {i, j in i < j})
print(volunteersSorted)

volunteersSorted = volunteerCounts.sorted(by: { $0 < $1 })
print(volunteersSorted)

volunteersSorted = volunteerCounts.sorted{ $0 < $1 }
print(volunteersSorted)


func makeTownGrand() -> (Int, Int) -> Int {
    func buildRoads(byAddingLights lights: Int,
                    toExistingLights existingLights: Int) -> Int {
        return lights + existingLights
    }
    return buildRoads
}

var stoplights = 4
let townPlanByAddingLightsToExistingLights = makeTownGrand()
stoplights = townPlanByAddingLightsToExistingLights(4, stoplights)
print("Knowhere has \(stoplights) stoplights.")



